package com.cb.service.impl;

import com.cb.dao.UserDao;
import com.cb.dao.impl.UserDaoImpl;
import com.cb.pojo.User;
import com.cb.service.UserService;

public class UserServiceImpl implements UserService {

    private UserDao userDao = new UserDaoImpl();

    public void sss(){
        System.out.println("哈哈哈");
    }
    public void sss2(){
        System.out.println("啪啪啪");
    }
    public void sss3(){
        System.out.println("女生");
    }

    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existUsername(String username) {
        if(userDao.queryUserByUsername(username)==null){
            return false;
        }
        return true;
    }
}
